= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 A u t h o r :   Y o u n g w o o k   K i m   ( K o r e a n ) 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 C o n t a c t :   r u m i a 0 6 0 1 @ g m a i l . c o m 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 0  %
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - \  %@  \  tǤ
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 tt,   Ƭ  4 |  %XՔ  )D  <   0(  H e l l o   W o r l d  |  t|)   4 |  %XՔ  )@    0.   \   ?   \аt  %@    \   Dptt  DȲ̹,   %@    \   m  Dptt0  L8t.   ( \X  X:   0   tX  %,   1   tX  %)   췘,     @  %t  DՔX.   t  Ƭ     D  P l a y \ |  йXՔ  t t.   P l a y |  貴Ŕ  X  |ǀ( Dȹĳ   }) D  x䲔  ;t.   ,   t  \ȸ     t  0  t  %  \D   t. 
 
 
 
 
 
 . .   i m a g e : :   B a g i c - I N P U T - s o u r c e c o d e . p n g 
 
       : c l a s s :   i n l i n e d - r i g h t 
 
 
 
 . .   c o d e - b l o c k : :   p y t h o n 
 
       : l i n e n o s : 
 
 
 
       i m p o r t   s y s ,   p y g a m e 
 
       p y g a m e . i n i t ( ) 
 
 
 
       s i z e   =   w i d t h ,   h e i g h t   =   2 2 0 ,   1 4 0 
 
       s p e e d   =   [ 2 ,   2 ] 
 
       b l a c k   =   0 ,   0 ,   0 
 
 
 
       s c r e e n   =   p y g a m e . d i s p l a y . s e t _ m o d e ( s i z e ) 
 
 
 
       b a l l   =   p y g a m e . i m a g e . l o a d ( " B a g i c - I N P U T - s o u r c e c o d e . p n g " ) 
 
       b a l l r e c t   =   b a l l . g e t _ r e c t ( ) 
 
 
 
       w h i l e   1 : 
 
               f o r   e v e n t   i n   p y g a m e . e v e n t . g e t ( ) : 
 
                       i f   e v e n t . t y p e   = =   p y g a m e . Q U I T :   s y s . e x i t ( ) 
 
 
 
               b a l l r e c t   =   b a l l r e c t . m o v e ( s p e e d ) 
 
               i f   b a l l r e c t . l e f t   <   0   o r   b a l l r e c t . r i g h t   >   w i d t h : 
 
                       s p e e d [ 0 ]   =   - s p e e d [ 0 ] 
 
               i f   b a l l r e c t . t o p   <   0   o r   b a l l r e c t . b o t t o m   >   h e i g h t : 
 
                       s p e e d [ 1 ]   =   - s p e e d [ 1 ] 
 
 
 
               s c r e e n . f i l l ( b l a c k ) 
 
               s c r e e n . b l i t ( b a l l ,   b a l l r e c t ) 
 
               p y g a m e . d i s p l a y . f l i p ( ) 
 
 
 
 
 
 . .   i m a g e : :   B a g i c - I N P U T - r e s u l t s c r e e n . p n g 
 
       : c l a s s :   i n l i n e d - r i g h t 
 
 
 
 . .   c o d e - b l o c k : :   p y t h o n 
 
       : l i n e n o s : 
 
 
 
       i m p o r t   s y s ,   p y g a m e 
 
       p y g a m e . i n i t ( ) 
 
 
 
       s i z e   =   w i d t h ,   h e i g h t   =   2 2 0 ,   1 4 0 
 
       s p e e d   =   [ 2 ,   2 ] 
 
       b l a c k   =   0 ,   0 ,   0 
 
 
 
       s c r e e n   =   p y g a m e . d i s p l a y . s e t _ m o d e ( s i z e ) 
 
 
 
       b a l l   =   p y g a m e . i m a g e . l o a d ( " B a g i c - I N P U T - r e s u l t s c r e e n . p n g " ) 
 
       b a l l r e c t   =   b a l l . g e t _ r e c t ( ) 
 
 
 
       w h i l e   1 : 
 
               f o r   e v e n t   i n   p y g a m e . e v e n t . g e t ( ) : 
 
                       i f   e v e n t . t y p e   = =   p y g a m e . Q U I T :   s y s . e x i t ( ) 
 
 
 
               b a l l r e c t   =   b a l l r e c t . m o v e ( s p e e d ) 
 
               i f   b a l l r e c t . l e f t   <   0   o r   b a l l r e c t . r i g h t   >   w i d t h : 
 
                       s p e e d [ 0 ]   =   - s p e e d [ 0 ] 
 
               i f   b a l l r e c t . t o p   <   0   o r   b a l l r e c t . b o t t o m   >   h e i g h t : 
 
                       s p e e d [ 1 ]   =   - s p e e d [ 1 ] 
 
 
 
               s c r e e n . f i l l ( b l a c k ) 
 
               s c r e e n . b l i t ( b a l l ,   b a l l r e c t ) 
 
               p y g a m e . d i s p l a y . f l i p ( ) 
 
 
 
 
 
 ( C o n t r o l l i n g   W o r l d   \ȸX    Tܴ  |ǀ  @    ) 
 
 
 
 ( C o n t r o l l i n g   W o r l d    ܴ  )դ|  tt  t  )<\  x. ) 
 
 
 
 t  \ȸ@  DPX  2 X  p  (tt  .   ɔ  # 5   K E W D O W N   tǤ   Ҭp  Ŕ  D̲|  XՔ  t.   x  @  tX  LବX  }  t  ٳXĳ]      X.   @  9   E v e n t 8  ^  ǐа    ǐа    DȈ  |    LD  Ƭ  L  .   \|  ptǸXՔ  ,   E v e n t 8t  ̸  t踴  ȩt|.   ( 8      ptǸ.   t  P  (tt. )     e v e n t . k e y   ܴ  ȹɹ<\    |  X\.   lx  X  tǄD  D|.   K _ U P ,   K _ L E F T ,   K _ D O W N ,   K _ R I G H T .   买   x  K _ ¬t.   ( H e a d e r X  p y g a m e . l o c a l s \0  tǩ`    . )   x  X  tǄ<\  K _ 8 ,   K _ a ,   K _ L ,   K _ L C T R L ,   K _ D E L E T E ,   L _ F 4 t  .   t  ĳ   x  ĳ  t   <\  tt`    .       tǄ  ]@  h t t p s : / / w w w . p y g a m e . o r g / d o c s / r e f / k e y . h t m l # p y g a m e . k e y . n a m e   Ux`    . 
 
 
 
 K E W D O W N @   t  Д  tŔ    JX̹,   @  8.  |  XX,    tȀ0  L  Ĭ    D\  .  |  XXɔ  JŔ.   $ǔ  |  0  t,   K E Y U P t|  tǤ|   <\  Uxt|  \.   ( @  Lବt  T   )   tǔ  T    踠. 
 
 
 
 %D   XՔ  @    tǤ  xǐ|   XՔ  t0  L8  }.   t    \ȸҔ  D1.   \аXt  \ȸ   %,   ̬,   %D     0  L8t.   ޹ ?   DȲ.   t  \ȸҔ    $ȸ  8֑ǩt     ,   t  ܭY( }pt( H P ,     ) ĳ    ĳ  ) t  ,   8  ( ٳ0  ƌ,   %  %X  䲑1,   P ) t  0  L8  t|      .    ,   X  x0јtǤ/ ¤\D  1XՌ  X0  t  Ƭ  T  %( ȹƤ    ) ,   ̬( \  hT) ,   %( t,         pt0  T  )) D  LD|  \.   <`,   0  ĬX  t  ܴ  ĳt  .   T  Ĭ\   ! 
 
 
 
 
 
 < 8  Tܴ>   : : 
 
 
 
         i m p o r t   p y g a m e ,   s y s 
 
         f r o m   p y g a m e . l o c a l s   i m p o r t * 
 
 
 
         w h i t e   =   ( 2 5 5 , 2 5 5 , 2 5 5 ) 
 
         r e d   =   ( 2 5 5 , 0 , 0 ) 
 
         g r e e n   =   ( 0 , 2 5 5 , 0 ) 
 
         p y g a m e . i n i t ( ) 
 
         p y g a m e . d i s p l a y . s e t _ c a p t i o n ( " C o n t r o l l i n g   W o r l d   P r o j e c t " )   
 
         m y S c r e e n   =   p y g a m e . d i s p l a y . s e t _ m o d e ( ( 6 4 0 ,   4 8 0 ) ) 
 
         m y T e x t F o n t   =   p y g a m e . f o n t . F o n t ( " H o o n W h i t e c a t R . t t f " ,   3 2 ) 
 
         m y T e x t   =   m y T e x t F o n t . r e n d e r ( " C o n t r o l l i n g   W o r l d ! " ,   T r u e ,   r e d ,   g r e e n )   
 
         m y T e x t A r e a   =   m y T e x t . g e t _ r e c t ( ) 
 
         m y T e x t A r e a . c e n t e r   =   ( 3 2 0 ,   2 4 0 ) 
 
         f p s C l o c k   =   p y g a m e . t i m e . C l o c k ( ) 
 
         x   =   0 
 
         y   =   0 
 
         m o v e R i g h t   =   0   # 1 
 
         m o v e D o w n   =   0   # 2 
 
 
 
         w h i l e   T r u e : 
 
                 m o v e R i g h t   =   0   # 3 
 
                 m o v e D o w n   =   0   # 4 
 
                 m y T e x t A r e a . c e n t e r   =   ( 3 2 0   +   x ,   2 4 0   +   y ) 
 
                 m y S c r e e n . f i l l ( w h i t e ) 
 
                 m y S c r e e n . b l i t ( m y T e x t ,   m y T e x t A r e a ) 
 
 
 
                 f o r   e v e n t   i n   p y g a m e . e v e n t . g e t ( ) : 
 
                         i f   e v e n t . t y p e   = =   Q U I T : 
 
                                 p y g a m e . q u i t ( ) 
 
                                 s y s . e x i t ( ) 
 
                         e l i f   e v e n t . t y p e   = =   K E Y D O W N :   # 5 
 
                                 i f   e v e n t . k e y   = =   K _ U P : 
 
                                         m o v e D o w n   =   - 1 
 
                                         m o v e R i g h t   =   0 
 
                                 e l i f   e v e n t . k e y   = =   K _ L E F T : 
 
                                         m o v e D o w n   =   0 
 
                                         m o v e R i g h t   =   - 1 
 
                                 e l i f   e v e n t . k e y   = =   K _ D O W N : 
 
                                         m o v e D o w n   =   1 
 
                                         m o v e R i g h t   =   0 
 
                                 e l i f   e v e n t . k e y   = =   K _ R I G H T : 
 
                                         m o v e D o w n   =   0 
 
                                         m o v e R i g h t   =   1 
 
                                 
 
                 i f ( m o v e R i g h t   = =   1 ) :   # 6 
 
                         x   =   x   +   1 0 
 
                 e l i f ( m o v e R i g h t   = =   - 1 ) :   # 7 
 
                         x   =   x   -   1 0 
 
                 i f ( m o v e D o w n   = =   1 ) :   # 8 
 
                         y   =   y   +   1 0 
 
                 e l i f ( m o v e D o w n   = =   - 1 ) :   # 9 
 
                         y   =   y   -   1 0 
 
 
 
                 p y g a m e . d i s p l a y . u p d a t e ( ) 
 
 
 
 